<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>08强化练习2_字符串</title>
</head>

<body>
</body>
<script>
  // 随机生成一个五位以内的数，然后输出该数共有多少位，每位分别是什么('个', '十', '百', '千', '万')
  var num = parseInt(Math.random() * 9999) + ''
  function fn(num) {
    str = '有' + num.length + '位数哦' + '每位分别是:'
    for (i = 0; i < num.length; i++) {
      str += num[i] + ','
    } return str
  }
  console.log(fn(num))


</script>

</html>